<div class="container-fluid domain-body">
	<div class="row-fluid">
		<form class="span10" id="domainForm">
			<span class="input-prepend ele">
				<span class="add-on">域名</span>
				<input type="text" placeholder="域名" name="domain">
			</span>
			<span class="input-prepend ele">
				<span class="add-on">源站IP(默认80端口)</span>
				<input type="text" placeholder="IP地址" name="ip">
			</span>
			<a class="btn ele" href="javascript:void(0);" id="domainAdd">添加</a>
			<?php if($info['dnspod'] == 'valid'){ ?>
				<!--<a href="./?dnspod"><div class="dnspod"></div>域名导入</a>!-->
			<?php } ?>
		</form>
		<?php if($info['dnspod'] == 'invalid'){ ?>
		<div class="span2 bind">
			<a href="./?profile">关联<div class="dnspod"></div></a>
		</div>
		<?php } ?>
	</div>
	<div class="row-fluid">
		<div class="span12">
			<table class="table table-hover">
				<thead>
					<tr>
					<th>域名</th>
					<th>源站IP</th>
					<th colspan="3">状态</th>
					<th>操作</th>
					</tr>
				</thead>
				<tbody>
					<?php foreach ($list as $value) { ?>
					<?php
						$styleClass = 'class="';
						if($value['status'] == 'invalid') $styleClass .= ' error ';
						if($value['dnspod'] != 0) $styleClass .= ' dnspod-ok ';
						$styleClass .= '"';
					?>
					<tr <?php echo $styleClass; ?> >
						<td><?php echo $value['domain_name']; ?>
							<i class="dnspod-mini" title="可通过DNSPod一键完成"></i>
						</td>
						<td>
							<span>
								<?php echo "{$value['source_ip']}:{$value['source_port']}"; ?>
								<a href="javascript:void(0);" class="domain-source-edit">
									<small>修改</small>
								</a>
							</span>
							<form style="display:none;">
								<input name="id" type="hidden" value="<?php echo $value['domain_id']; ?>">
								<div class="input-append" style="float:left;">
									<input type="text" class="input-small" value="<?php echo "{$value['source_ip']}:{$value['source_port']}"; ?>" name="ip">
									<a class="btn domain-source-save" href="javascript:void(0);">保存</a>
								</div>
								<a href="javascript:void(0);" class="edit-cancel" style="padding:5px 0px 0px 5px;">
									<small>取消</small>
								</a>
							</form>
						</td>
						<td colspan="3" class="<?php if($value['status'] != 'invalid') echo 'valid'; else echo 'invalid'; ?>">
							<span class="status-on">加速中</span><span class="status-off">未生效</span>
							<i class="icon-refresh" data-id="<?php echo $value['domain_id']; ?>"></i>
							<img src="./resource/image/load.gif" class="load"/>
							<i class="icon-info-sign"></i>
							<div class="domain-info well well-small row-fluid">
								<div class="span6 well-cname <?php if($value['status'] == 'cname') echo 'record-valid'; ?>">
									<strong>
										CNAME记录指向
										<span class="record-status">(<span class="green">已生效</span>)</span>
										<i class="dnspod-cname dnspod-mini" data-id="<?php echo $value['domain_id']; ?>" title="通过DNSPod一键完成"></i>
										<img src="./resource/image/load.gif" class="load">
									</strong><br>
									<span class="green">
									<?php echo $value['cname_domain']; ?>
									</span>
								</div>
								<div class="span6 well-a <?php if($value['status'] == 'a') echo 'record-valid'; ?>">
									<strong>A记录指向
										<span class="record-status">(<span class="green">已生效</span>)</span>
										<i data-id="<?php echo $value['domain_id']; ?>" class="dnspod-a dnspod-mini" title="通过DNSPod一键完成"></i>
										<img src="./resource/image/load.gif" class="load">
									</strong><br>
									<?php
									$ips = explode(',', $value['a_ip']);
									foreach ($node as $nodeKey => $nodeValue) {
										if(in_array($nodeValue['NodeIP'], $ips)){
											echo "<span class=\"green\">{$nodeValue['NodeIP']}</span><br/>";
										}else echo "{$nodeValue['NodeIP']}</span><br/>";
									}
									?>
								</div>
								<div class="or">或</div>
							</div>
						</td>
						<td>
							<a title="配置缓存" href="./?domainSet:<?php echo $value['domain_id']; ?>" >
								<i class="icon-wrench"></i>
							</a>
							<a title="清除缓存" href="./?purge:<?php echo $value['domain_id']; ?>">
								<i class="icon-repeat"></i>
							</a>
							<a title="删除该站点" href="javascript:void(0);" onClick="confirm('是否删除该站点',function(){domainRemove(<?php echo $value['domain_id']; ?>);});";>
								<i class="icon-remove"></i>
							</a>
						</td>
					</tr>
					<?php } ?>
				</tbody>
			</table>
		</div>
	</div>
</div>
			